package com.zeng.service.impl;

import com.zeng.entity.Logsinfo;
import com.zeng.dao.LogsinfoDao;
import com.zeng.service.LogsinfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Logsinfo)表服务实现类
 *
 * @author zengfanchao
 * @since 2021-03-29 14:18:41
 */
@Service("logsinfoService")
public class LogsinfoServiceImpl implements LogsinfoService {
    @Resource
    private LogsinfoDao logsinfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param logid 主键
     * @return 实例对象
     */
    @Override
    public Logsinfo queryById(Integer logid) {
        return this.logsinfoDao.queryById(logid);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @Override
    public List<Logsinfo> queryAllByLimit(int offset, int limit) {
        return this.logsinfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param logsinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Logsinfo insert(Logsinfo logsinfo) {
        this.logsinfoDao.insert(logsinfo);
        return logsinfo;
    }

    /**
     * 修改数据
     *
     * @param logsinfo 实例对象
     * @return 实例对象
     */
    @Override
    public Logsinfo update(Logsinfo logsinfo) {
        this.logsinfoDao.update(logsinfo);
        return this.queryById(logsinfo.getLogid());
    }

    /**
     * 通过主键删除数据
     *
     * @param logid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer logid) {
        return this.logsinfoDao.deleteById(logid) > 0;
    }

    @Override
    public List<Logsinfo> selectAll() {
        return this.logsinfoDao.selectAll();
    }

    @Override
    public int queryCount() {
        return this.logsinfoDao.queryCount();
    }

    @Override
    public int queryCountSelect(String key) {
        return this.logsinfoDao.queryCountSelect(key);
    }

    @Override
    public List<Logsinfo> queryKeyByLimit(String key, Integer offset, Integer limit) {
        return this.logsinfoDao.queryKeyByLimit(key, offset, limit);
    }

}
